import * as types from '../actions/actionTypes';

const initialState = {
    status: false,
    code: 0,
    message: '',
    user: {},
    share: {},
    isLoading: false,
    imageInfoList:[],
    needImageCount:0,
    allProviderTaskList:[],
    taskList:[],
    newTaskList:[],
};

let chexianReducer = (state=initialState, action) => {
    switch (action.type) {
        case types.kQueryAllProviderTaskList:
            return {
                ...state,
                isLoading: true,
            };
        case types.kQueryAllProviderTaskListReceived:
            return {
                ...state,
                isLoading:false,
                allProviderTaskList:action.allProviderTaskList,
            };
        case types.kQueryUploadImageList:
            return {
                ...state,
                isLoading: true,
            };
        case types.kQueryUploadImageListReceived:
            return {
                ...state,
                isLoading:false,
                needImageCount:action.needImageCount,
                imageInfoList: action.imageInfoList,
            };
        case types.kUploadImage:
            return {
                ...state,
                isLoading: true,
            };
        case types.kUploadImageReceived:
            return {
                ...state,
                isLoading:false,
                needImageCount:action.needImageCount,
                imageInfoList: action.imageInfoList,
            };
        case types.kTaskList:
            return {
                ...state,
                isLoading: true,
            };
        case types.kTaskListReceived:
            return {
                ...state,
                isLoading:false,
                taskList: action.taskList,
            };
        case types.kTaskList2:
            return {
                ...state,
                isLoading: true,
            };
        case types.kTaskList2Received:
            return {
                ...state,
                isLoading:false,
                newTaskList: action.newTaskList,
            };
        case types.kNewTaskListReceived:
            return {
                ...state,
                isLoading:false,
                newTaskList: action.newTaskList,
            };
        default:
            return state;
    }
};

export default chexianReducer;